<?php
/*
	插件初始化
*/
if($_RQ['storeid']){
	$this->session('store_id',intval($_RQ['storeid']));
	$worker=pdo_get('jy_weishop_store_worker',array('mid'=>$_SESSION['uid'],'storeid'=>intval($_RQ['storeid']),'uniacid'=>$_SESSION['uniacid']));
}else{
	$worker=pdo_get('jy_weishop_store_worker',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$this->session('store_id',intval($worker['storeid']));
}
$this->workerid=$worker['id'];
if($worker['roleid']){
	$perms_mobile=pdo_getcolumn('jy_weishop_store_role',array('id'=>$worker['roleid'],'uniacid'=>$_SESSION['uniacid']),'perms_mobile');	
	if($perms_mobile){
		$check=strexists($perms_mobile,';jy_weishop/'.$_RQ['action'].'/;');
		if(!$check && $_RQ['action']!='store.manage.index' && $_RQ['action']!='store.manage.verifylog' && $_RQ['action']!='store.manage.verifyselflog' && $_RQ['action']!='store.manage.verifynumlog'){
			if(strexists($perms_mobile,';jy_weishop/store.manage.order/;') && $_RQ['action']=='store.manage.order_detail'){
				
			}else{
				exi('你没有该页面权限！请联系管理员开通！','error','jy_weishop/store.manage.index/');
			}
		}
	}
}
$this->model('member')->checklogin();
$this->store_id=$this->session('store_id');
if(!$this->workerid){
	$current_plugin=$_SESSION['current_plugin']?:'jy_weishop';
	exi('你不是本店店员，无法登录','error',$current_plugin.'/index/');
}